package yxy.game.pm2.module.union.rank;

import org.redisson.api.RScoredSortedSet;
import yxy.game.pm2.bean.ServerBean;
import yxy.game.pm2.bean.area.AreaBean;
import yxy.game.pm2.bean.area.AreaGroupBean;
import yxy.game.pm2.bean.cluster.ClusterBean;
import yxy.game.pm2.bean.module.rank.PlayerRankModule;
import yxy.game.pm2.module.union.UnionBean;

/** 联盟活跃排名 */
public class RankActiveUnionHandle {
	private UnionBean unionBean;
	private ServerBean serverBean;
	private ClusterBean clusterBean;
	private AreaBean areaBean;
	private AreaGroupBean areaGroupBean;

	public UnionBean getUnionBean() {
		return unionBean;
	}

	public void setUnionBean(UnionBean unionBean) {
		this.unionBean = unionBean;
	}

	public ServerBean getServerBean() {
		return serverBean;
	}

	public void setServerBean(ServerBean serverBean) {
		this.serverBean = serverBean;
	}

	public ClusterBean getClusterBean() {
		return clusterBean;
	}

	public void setClusterBean(ClusterBean clusterBean) {
		this.clusterBean = clusterBean;
	}

	public AreaBean getAreaBean() {
		return areaBean;
	}

	public void setAreaBean(AreaBean areaBean) {
		this.areaBean = areaBean;
	}

	public AreaGroupBean getAreaGroupBean() {
		return areaGroupBean;
	}

	public void setAreaGroupBean(AreaGroupBean areaGroupBean) {
		this.areaGroupBean = areaGroupBean;
	}

	public RankActiveUnionHandle (UnionBean unionBean) {
		ServerBean serverBean = ServerBean.get(unionBean.getServerId());
		AreaBean areaBean = AreaBean.get(serverBean.getAreaId());
		AreaGroupBean areaGroupBean = AreaGroupBean.get(areaBean.getGroupId());
		ClusterBean clusterBean = ClusterBean.get(areaBean.getClusterId());

		setUnionBean(unionBean);
		setServerBean(serverBean);
		setAreaBean(areaBean);
		setAreaGroupBean(areaGroupBean);
		setClusterBean(clusterBean);
	}

	public static RankActiveUnionHandle get(UnionBean unionBean) {
		return new RankActiveUnionHandle(unionBean);
	}

	public void remove (String unionCode) {
		new RankActiveUnion(clusterBean.getClusterId()).remove(unionCode);
	}
}
